import axios from './axios'

export const getAccidentsByElder = (elderId) => axios.get('/caregiver/accident/getByElderId', { params: { elderId } })
export const getAccidentsByCaregiver = (caregiverId, params = {}) => axios.get(`/caregiver/accident/getByCaregiver/${caregiverId}`, { params })
export const addAccident = (data) => axios.post('/caregiver/accident/add', data)
export const addAccidentRecord = (data) => axios.post('/caregiver/accident/add', data)
// ✅ 改成 Vue 侧期望的名字
export const updateAccident = (recordId, data) =>
    axios.put(`/caregiver/accident/update/${recordId}`, data)
export const updateAccidentRecord = (recordId, data) =>
    axios.put(`/caregiver/accident/update/${recordId}`, data)
export const deleteAccident = (recordId) => axios.delete(`/caregiver/accident/delete/${recordId}`)
export const deleteAccidentRecord = (recordId) =>
    axios.delete(`/caregiver/accident/delete/${recordId}`)
export const getAccidentChart = () => axios.get('/caregiver/accident/chart')

// 缺失接口补充
export const getAccidentList = (params) => request.get('/accident', { params })
export const updateAccidentStatus = (data) => request.put('/accident/status', data)
export const accidentApi = {
    list: (params) => request.get('/accident', { params }),
    updateStatus: (data) => request.put('/accident/status', data)
}